<?php

/**
 * This is the model class for table "jumlahayamburasitik".
 *
 * The followings are the available columns in table 'jumlahayamburasitik':
 * @property integer $jabi_id
 * @property integer $jabi_kec
 * @property integer $jabi_ayam_jantan
 * @property integer $jabi_ayam_betina
 * @property integer $jabi_ayam_jumlah
 * @property integer $jabi_itik_jantan
 * @property integer $jabi_itik_betina
 * @property integer $jabi_itik_jumlah
 * @property integer $jabi_tahun
 *
 * The followings are the available model relations:
 * @property Kecamatan $jabiKec
 */
class Jumlahayamburasitik extends CActiveRecord
{
	/**
	 * Returns the static model of the specified AR class.
	 * @return Jumlahayamburasitik the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}

	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return 'jumlahayamburasitik';
	}

	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules()
	{
		// NOTE: you should only define rules for those attributes that
		// will receive user inputs.
		return array(
			array('jabi_kec, jabi_ayam_jantan, jabi_ayam_betina, jabi_ayam_jumlah, jabi_itik_jantan, jabi_itik_betina, jabi_itik_jumlah, jabi_tahun', 'numerical', 'integerOnly'=>true),
			// The following rule is used by search().
			// Please remove those attributes that should not be searched.
			array('jabi_id, jabi_kec, jabi_ayam_jantan, jabi_ayam_betina, jabi_ayam_jumlah, jabi_itik_jantan, jabi_itik_betina, jabi_itik_jumlah, jabi_tahun', 'safe', 'on'=>'search'),
		);
	}

	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		// NOTE: you may need to adjust the relation name and the related
		// class name for the relations automatically generated below.
		return array(
			'jabiKec' => array(self::BELONGS_TO, 'Kecamatan', 'jabi_kec'),
		);
	}

	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels()
	{
		return array(
			'jabi_id' => 'Jabi',
			'jabi_kec' => 'Jabi Kec',
			'jabi_ayam_jantan' => 'Ayam Buras Jantan',
			'jabi_ayam_betina' => 'Ayam Buras Betina',
			'jabi_ayam_jumlah' => 'Jumlah Ayam Buras',
			'jabi_itik_jantan' => 'Itik Jantan',
			'jabi_itik_betina' => 'Itik Betina',
			'jabi_itik_jumlah' => 'Jumlah Itik',
			'jabi_tahun' => 'Tahun',
		);
	}

	/**
	 * Retrieves a list of models based on the current search/filter conditions.
	 * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
	 */
	public function search()
	{
		// Warning: Please modify the following code to remove attributes that
		// should not be searched.

		$criteria=new CDbCriteria;

		$criteria->compare('jabi_id',$this->jabi_id);
		$criteria->compare('jabi_kec',$this->jabi_kec);
		$criteria->compare('jabi_ayam_jantan',$this->jabi_ayam_jantan);
		$criteria->compare('jabi_ayam_betina',$this->jabi_ayam_betina);
		$criteria->compare('jabi_ayam_jumlah',$this->jabi_ayam_jumlah);
		$criteria->compare('jabi_itik_jantan',$this->jabi_itik_jantan);
		$criteria->compare('jabi_itik_betina',$this->jabi_itik_betina);
		$criteria->compare('jabi_itik_jumlah',$this->jabi_itik_jumlah);
		$criteria->compare('jabi_tahun',$this->jabi_tahun);

		return new CActiveDataProvider($this, array(
			'criteria'=>$criteria,
		));
	}
}